<?php
/**
 * Created by PhpStorm.
 * User: woody
 * Date: 17-2-16
 * Time: 下午10:46
 */

namespace App\Http\Controllers\Api;
use App\Models\Pointapi;
use Illuminate\Http\Request;

class PointController extends ApiController {

    public function __construct()
    {
        parent::__construct();
        $this->_response['_active']['_model']       = 'pointsfor';
        $this->_response['_active']['_action']      = '';
        $this->_response['_title']                  = '小一农货-积分提现接口';
    }

    public function index(){
        global $g_uid;
        $id=$g_uid;
        $this->_response['_active']['_action']      = 'list';

        $pointforModel = new Pointapi();

        $data = $pointforModel->getData();
        if(!empty($data)){
            $this->_response['pointfor'] = $data;
            return response()->json(['code' => 0, 'msg' => '返回成功','data'=>$this->_response]);
        }else{
            return response()->json(['code' => -1, 'msg' => '返回失败']);
        }
    }
    
//    public function doAdd(\App\Http\Requests\Pointfor $request){
//        $data = $request->all();
//        $saveData = [
//            'points' => $data['points'],
//            'money'=>$data['money'],
//            'user_id' => $data['user_id'],
//            'withdrawal_address' => $data['withdrawal_address'],
//            'created_at' => date('Y-m-d H:i:s', time()),
//        ];
//        if($data['money']<100){
//            return response()->json(['code' => -2, 'msg' => '金额小于100不可转账']);
//        }else{
//            $pointforModel = new Pointapi();
//            if($pointforModel->saveData($saveData)){
//                return response()->json(['code' => 0, 'msg' => '提现申请成功']);
//            }else{
//                return response()->json(['code' => -1, 'msg' => '提现申请失败']);
//            }
//        }
//
//    }



}